<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>农汇购-会员信息修改</title>
<link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
<link href="${pageContext.request.contextPath }/layui/css/layui.css" rel="stylesheet">
<script src="${pageContext.request.contextPath }/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath }/layui/layui.js"></script>
<style>
	#role,#flag{
		width:95%;
		height:33px;
	}
	
</style>
</head>

<body>
<div class="layui-form-item">
	    <label class="layui-form-label">角色</label>
	    <div class="layui-input-block">
	      <select id="role" name="role" lay-verify="required">
        <option value="0">买家</option>
        <option value="1">商家</option>
      </select>
	    </div>
	  </div>
	  
	  <div class="layui-form-item">
	    <label class="layui-form-label">状态</label>
	    <div class="layui-input-block">
	      <select id="flag" name="flag" >
        <option value="0">未审核</option>
        <option value="1">正常</option>
        <option value="2">封停</option>
        <option value="3">封禁</option>
      </select>
	    </div>
	  </div>
	
	  
	<form class="layui-form">
		<input type="hidden" id="id" name="id" value="${user.id}" />
	  <div class="layui-form-item">
	    <label class="layui-form-label">账号</label>
	    <div class="layui-input-block">
	      <input type="text" id="account" name="account" value="${user.account}" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">手机号</label>
	    <div class="layui-input-block">
	      <input type="text" id="phone" name="phone" value="${user.phone}" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	  <div class="layui-form-item">
	    <label class="layui-form-label">新密码</label>
	    <div class="layui-input-block">
	      <input type="text" id="pwd" name="pwd" autocomplete="off" class="layui-input">
	    </div>
	  </div>
	 
	  <div class="layui-form-item">
	    <div class="layui-input-block">
	      <button class="layui-btn" onclick="submmitMsg()">立即提交</button>
	      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
	    </div>
	  </div>
	</form>
	 
	  
	
</body>
<script type="text/javascript">
	var role = ${user.role}
	var flag = ${user.flag}
	$(function(e){
		$("#role").val(role)
		$("#flag").val(flag)
		console.log("role:"+role)
		console.log("flag:"+flag)
	});
	
	function submmitMsg(){
		$.ajax({
			//请求路径
			url:"/rj2002/admin/updateUser",
			//请求方式 get post ...
			type:"post",
			dataType:"json",
			data:{
				'id':$("#id").val(),
				'account':$("#account").val(),
				'phone':$("#phone").val(),
				'passwords':$("#pwd").val(),
				'role':$("#role").val(),
				'flag':$("#flag").val()
			},
			//请求成功后做的事情
			success:function(data){
				layer.msg(data.data);
			},
			//请求失败后做的事情
			error:function(XMLHttpRequest,textStatus,errorThrown){
				layer.msg("error");
			}
		});
	}
	var layer;
	layui.config({
	    base: "js/"
	}).use('layer',function () {
    	layer = parent.layer === undefined ? layui.layer : parent.layer;
    })
	
</script>
</html>